package io.vincentwinner.systeminfoapi.dao.impl;

import io.vincentwinner.systeminfoapi.dao.IOperatingSystemDao;
import io.vincentwinner.toolset.os.Computer;
import io.vincentwinner.toolset.os.OperatingSystem;
import org.springframework.stereotype.Repository;
import oshi.software.os.OSProcess;
import oshi.software.os.OSService;

import java.util.List;

/**
 * @see IOperatingSystemDao
 */
@Repository("osDao")
public class OperatingSystemDaoImpl implements IOperatingSystemDao {

    private final OperatingSystem os = Computer.getOperatingSystem();
    private final OperatingSystem.StaticSystemInfo staticSystemInfo = Computer.getStaticSystemInfo();

    @Override
    public String getOSName() {
        return staticSystemInfo.osName();
    }

    @Override
    public String getArch() {
        return staticSystemInfo.arch();
    }

    @Override
    public String getOSVersion() {
        return staticSystemInfo.osVersion();
    }

    @Override
    public String getOSUserName() {
        return staticSystemInfo.osUserName();
    }

    @Override
    public String getUserHome() {
        return staticSystemInfo.userHome();
    }

    @Override
    public String getLineSeparator() {
        return staticSystemInfo.lineSeparator();
    }

    @Override
    public String getPathSeparator() {
        return staticSystemInfo.pathSeparator();
    }

    @Override
    public String getFileSeparator() {
        return staticSystemInfo.fileSeparator();
    }

    @Override
    public int getBit() {
        return staticSystemInfo.bit();
    }

    @Override
    public long sinceBootTime() {
        return os.sinceBootTime();
    }

    @Override
    public List<OSProcess> getProcesses() {
        return os.getProcesses();
    }

    @Override
    public int getProcessesCount() {
        return os.getProcessesCount();
    }

    @Override
    public int getThreadCount() {
        return os.getThreadCount();
    }

    @Override
    public List<OSService> getServices() {
        return os.getServices();
    }

}
